package com.taobao.tbk.service;

import com.taobao.tbk.dao.BannerDO;
import com.taobao.tbk.dao.CommonNavDO;
import com.taobao.tbk.dao.CommonNavItemDO;
import com.taobao.tbk.mapper.BannerDOMapper;
import com.taobao.tbk.mapper.CommonNavDOMapper;
import com.taobao.tbk.mapper.CommonNavItemDOMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConfService {

    @Autowired
    private BannerDOMapper bannerDOMapper;

    @Autowired
    private CommonNavDOMapper commonNavDOMapper;

    @Autowired
    private CommonNavItemDOMapper commonNavItemDOMapper;

    /**
     * 获取首页banner图片地址
     * @return banner图片地址列表
     */
    public List<BannerDO> getBanners() {
        List<BannerDO> bannerDOList = bannerDOMapper.selectBySort();
        return bannerDOList;
    }


    /**
     * 获取导航列表
     * @return  导航列表
     */
    public List<CommonNavDO> getCommonNavList() {
        List<CommonNavDO> commonNavDOList = commonNavDOMapper.selectBySort();
        return commonNavDOList;
    }

    /**
     * 获取导航对应关联词列表
     * @param navId 对应导航id
     * @return  导航关键词列表
     */
    public List<CommonNavItemDO> getNavItemList(Integer navId) {
        List<CommonNavItemDO> commonNavItemDOList = commonNavItemDOMapper.selectByNavId(navId);
        return commonNavItemDOList;
    }


}
